#include <ntddk.h>

KTIMER Timer;
KDPC TimerDpc;

VOID
DriverUnload(_In_ PDRIVER_OBJECT DriverObject);

VOID
InitializeAndStartTimer(ULONG msec);

VOID
OnTimerExpired(KDPC* Dpc, PVOID Context, PVOID, PVOID);

EXTERN_C
NTSTATUS
DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegisterPath)
{
	DriverObject->DriverUnload = DriverUnload;

	KdPrint(("Driver loaded successfully\n"));

	InitializeAndStartTimer(3000); // 3s

	return STATUS_SUCCESS;
}

VOID
DriverUnload(_In_ PDRIVER_OBJECT DriverObject)
{
	KdPrint(("Driver uninstalled successfully\n"));
}

VOID
InitializeAndStartTimer(ULONG Msec)
{
	KeInitializeTimer(&Timer);
	KeInitializeDpc(&TimerDpc, OnTimerExpired, nullptr);

	LARGE_INTEGER Interval;
	Interval.QuadPart = -10000LL * Msec;
	KeSetTimer(&Timer, Interval, &TimerDpc);
}

VOID
OnTimerExpired(KDPC* Dpc, PVOID Context, PVOID SystemArgument1, PVOID)
{
	KdPrint(("OnTimerExpired Execute!\n"));
	KdPrint(("DISPATCH_LEVEL: %s\n", KeGetCurrentIrql() == DISPATCH_LEVEL ? "True" : "False"));
}